//
//  CellForClickGuoWai.m
//  SeeTheWorld
//
//  Created by dllo on 16/1/27.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "CellForClickGuoWai.h"
#import "PCH.pch"
#import "ModelForClickGuoWai.h"
#import <UIImageView+WebCache.h>


@interface CellForClickGuoWai ()

@property (nonatomic, retain)UIImageView *imageViewBack;
@property (nonatomic, retain)UILabel *labelOfName;
@property (nonatomic, retain)UILabel *labelOfEnglish;
@property (nonatomic, retain)UIView *view1;

@end

@implementation CellForClickGuoWai

- (void)dealloc {
    [_view1 release];
    [_imageViewBack release];
    [_labelOfEnglish release];
    [_labelOfName release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.view1 = [[UIView alloc] init];
        [self.contentView addSubview:self.view1];
        [_view1 release];
        self.view1.backgroundColor = [UIColor lightGrayColor];
        
        self.imageViewBack = [[UIImageView alloc] init];
        [self.contentView addSubview:self.imageViewBack];
        [_imageViewBack release];
        self.imageViewBack.backgroundColor = [UIColor grayColor];
        
        self.labelOfName = [[UILabel alloc] init];
        [self.contentView addSubview:self.labelOfName];
        [_labelOfName release];
        self.labelOfName.textColor = [UIColor whiteColor];
        self.labelOfName.font = [UIFont systemFontOfSize:20];
        
        self.labelOfEnglish = [[UILabel alloc] init];
        [self.contentView addSubview:self.labelOfEnglish];
        [_labelOfEnglish release];
        self.labelOfEnglish.textColor = [UIColor whiteColor];
        self.labelOfEnglish.font = [UIFont systemFontOfSize:15];
 
    }
    
    return self;
}

/** 布局子视图 */
- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.view1.frame = CGRectMake(8, 8, scWIDTH - 16, scHEIGHT - 16);
    self.imageViewBack.frame = CGRectMake(8, 8, self.view1.frame.size.width, self.view1.frame.size.height);
    self.labelOfName.frame = CGRectMake(17, 18, scWIDTH, 30);
    self.labelOfEnglish.frame = CGRectMake(17, 47, scWIDTH, 30);
  
}

/** 赋值 */
- (void)passModel:(ModelForClickGuoWai *)model {
    
    [self.imageViewBack sd_setImageWithURL:[NSURL URLWithString:model.image_url] placeholderImage:[UIImage imageNamed:@"1f178a82b9014a90e9109296ad773912b31beeeb"]];
    
    self.labelOfName.text = model.name_zh_cn;
    
    self.labelOfEnglish.text = model.name_en;
}



















- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
